﻿@model FantasyDraft2.Models.UserDetailsViewModel

@{
    ViewBag.Title = "Team Details";
}

<h2>@ViewBag.Title</h2>
@if (Model.players.Count() > 0)
{
    <table>
        <tr>
            <th>Name</th>
            <th>Injured</th>
            <th>Active</th>
            <th>Assists</th>
            <th>Goals</th>
            <th>Update</th>
        </tr>
        @foreach (FantasyDraft2.Models.Player p in Model.players)
        {
            <tr>
                <td>
                    @p.Name
                </td>
                <td>
                    @if (@p.IsInjured)
                    {
                        <span style="color: green;">true</span> 
                    }
                    else
                    {
                        <span style="color: red;">false</span> 
                    }
                </td>
                <td>
                    @if (@p.IsActive)
                    {
                        <span style="color: green;">true</span> 
                    }
                    else
                    {
                        <span style="color: red;">false</span> 
                    }
                </td>
                <td>
                    @p.Assists
                </td>
                <td>
                    @p.Goals
                </td>
                @if (@p.IsActive)
                {
                    <td>
                        @Html.ActionLink("Bench Player", "Bench", new { pid = p.PlayerId, tid = p.TeamId })
                    </td>
                }
                @if (!p.IsActive)
                {
                    <td>
                        @Html.ActionLink("Activate Player", "Active", new { pid = p.PlayerId, tid = p.TeamId })
                    </td>
                }
            </tr>
        }
    </table>
}
else
{
    <div>No players on this team. Draft some!</div>   
}
<h2>Comments</h2>
@if (Model.comments.Count() > 0)
{
    <table>
        @foreach (FantasyDraft2.Models.UserComment c in Model.comments)
        {
            <tr>
                <td>
                    @c.Comment
                </td>
            </tr>
        }
    </table>
}
else
{
    <div>No Comments Found!</div>
}
@using (Html.BeginForm())
{
    <table>
        <tr>
            <td>
                <input type="submit" name="button" value="Add Comment" />
            </td>
            <td>
                <input type="submit" name="button" value="Back to Team Overview" />
            </td>
        </tr>
    </table>
    
    @Html.HiddenFor(x => Model.userId)
}
